﻿using System;
using System.Drawing;

namespace MarioMapEditor
{
    class ObMountain : ObObject
    {
        public enum MOUNTAIN {Mountain_Big =20, Mountain_Small };

        protected int WidthBig;
        protected int HeightBig;

        public ObMountain()
        {
            WidthBig    = 7;
            HeightBig   = 3;
            Width       = 5;
            Height      = 2;
        }

        public ObMountain(MOUNTAIN nID)
        {
            ID          = (int)nID;
            WidthBig    = 7;
            HeightBig   = 3;
            Width       = 5;
            Height      = 2;
        }

        public override bool SetID(int nID)
        {
            if (checkType(nID))
            {
                ID = nID;
                return true;
            }
            return false;
        }

        public static bool checkType(int objectID)
        {
            if (Enum.IsDefined(typeof(MOUNTAIN), objectID))
            {
                return true;
            }
            return false;
        }

        public override int GetWidth()
        {
            if (ID == (int)MOUNTAIN.Mountain_Big)
            {
                return WidthBig;
            }
            if (ID == (int)MOUNTAIN.Mountain_Small)
            {
                return Width;
            }
            return 0;
        }

        public override int GetHeight()
        {
            if (ID == (int)MOUNTAIN.Mountain_Big)
            {
                return HeightBig;
            }
            if (ID == (int)MOUNTAIN.Mountain_Small)
            {
                return Height;
            }
            return 0;
        }

        public override Bitmap GetBitmap()
        {
            if (!checkType(ID))
            {
                return null;
            }
            Bitmap src;
            switch (ID)
            {
                case (int) MOUNTAIN.Mountain_Big:
                    src = Properties.Resources.Mountain;
                    return MainForm.ResizeImage(src,new Size(WidthBig * MainForm.TileSize,HeightBig * MainForm.TileSize));
                case (int) MOUNTAIN.Mountain_Small:
                    src = Properties.Resources.Mountain;
                    return MainForm.ResizeImage(src, new Size(Width * MainForm.TileSize, Height * MainForm.TileSize));
            }

            return null;
        }
    }
}
